<?php
namespace app\index\controller;

class Member extends CheckMember
{
    /**
     * 就行个人中心首页
     * @return \think\response\View
     */
    public function index() {
        $data = $this->local_invoke_api('get_member_info', ['member_id' => session('member_id')]);
        if (!$data['data']['headimgurl'] && session('?headimgurl')) {
            $data['data']['headimgurl'] = get_img_url(session('headimgurl'));
        }
        $this->assign('data', $data['data']);
        return view();
    }

    /**
     * 个人信息
     * @return \think\response\View
     */
    public function member_info() {
        $data = $this->local_invoke_api('get_member_role_info', ['member_id' => session('member_id')]);
        if (!$data['data']['headimgurl'] && session('?headimgurl')) {
            $data['data']['headimgurl'] = get_img_url(session('headimgurl'));
        }
        $this->assign('data', $data['data']);
        return view();
    }

    /**
     * 修改保存个人信息
     * @return \think\response\Json
     */
    public function save_member_role_info() {
        $param = input('param.');
        $param['member_id'] = session('member_id');
        $data = $this->local_invoke_api('save_member_role_info', $param);
        return json($data);
    }
}
